package com.gbk.clickhouseservicesave.controller;

import com.gbk.clickhouseservicesave.dto.ChTableData;
import com.gbk.clickhouseservicesave.service.MessagePublisher;
import com.les.ads.ds.ReturnEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 *@ClassName generalController
 *@Author: gbk
 *@Description TODO:
 *@Version: 1.0
 */

@RestController
@RequestMapping("/test")
public class generalController {

    @Autowired
    private MessagePublisher messagePublisher;

    @PostMapping("/{className}")
    public ReturnEntity<?> saveData(@PathVariable String className, @RequestBody String data){
        messagePublisher.publicMessage(ChTableData.builder().className(className).data(data).build());
        return new ReturnEntity<>(true,"保存成功");
    }
}
